package cn.yuanqiao.web.controller.archive.quanzongjuanguanli;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.yuanqiao.common.annotation.Log;
import cn.yuanqiao.common.enums.BusinessType;

import cn.yuanqiao.archive.quanzongjuanguanli.domain.YqqzjjsCwb;
import cn.yuanqiao.archive.quanzongjuanguanli.service.IYqqzjjsCwbService;
import cn.yuanqiao.common.web.controller.BaseController;
import cn.yuanqiao.common.core.domain.AjaxResult;
import cn.yuanqiao.common.utils.poi.ExcelUtil;
import cn.yuanqiao.common.web.page.TableDataInfo;

/**
 * 全宗卷介绍长文本Controller
 * 
 * @author sy
 * @date 2023-09-20
 */
@RestController
@RequestMapping("/archive/YqqzjjsCwb")
public class YqqzjjsCwbController extends BaseController
{
    @Autowired
    private IYqqzjjsCwbService yqqzjjsCwbService;

    /**
     * 查询全宗卷介绍长文本列表
     */
    @PreAuthorize("@ss.hasPermi('archive:YqqzjjsCwb:list')")
    @GetMapping("/list")
    public TableDataInfo list(YqqzjjsCwb yqqzjjsCwb)
    {
        startPage();
        List<YqqzjjsCwb> list = yqqzjjsCwbService.selectYqqzjjsCwbList(yqqzjjsCwb);
        return getDataTable(list);
    }

    /**
     * 导出全宗卷介绍长文本列表
     */
    @PreAuthorize("@ss.hasPermi('archive:YqqzjjsCwb:export')")
    @Log(title = "全宗卷介绍长文本", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YqqzjjsCwb yqqzjjsCwb)
    {
        List<YqqzjjsCwb> list = yqqzjjsCwbService.selectYqqzjjsCwbList(yqqzjjsCwb);
        ExcelUtil<YqqzjjsCwb> util = new ExcelUtil<YqqzjjsCwb>(YqqzjjsCwb.class);
        util.exportExcel(response, list, "全宗卷介绍长文本数据");
    }

    /**
     * 获取全宗卷介绍长文本详细信息
     */
    @PreAuthorize("@ss.hasPermi('archive:YqqzjjsCwb:query')")
    @GetMapping(value = "/{yqqzjjsId}")
    public AjaxResult getInfo(@PathVariable("yqqzjjsId") String yqqzjjsId)
    {
        return success(yqqzjjsCwbService.selectYqqzjjsCwbByYqqzjjsId(yqqzjjsId));
    }

    /**
     * 新增全宗卷介绍长文本
     */
    @PreAuthorize("@ss.hasPermi('archive:YqqzjjsCwb:add')")
    @Log(title = "全宗卷介绍长文本", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YqqzjjsCwb yqqzjjsCwb)
    {
        return toAjax(yqqzjjsCwbService.insertYqqzjjsCwb(yqqzjjsCwb));
    }

    /**
     * 修改全宗卷介绍长文本
     */
    @PreAuthorize("@ss.hasPermi('archive:YqqzjjsCwb:edit')")
    @Log(title = "全宗卷介绍长文本", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YqqzjjsCwb yqqzjjsCwb)
    {
        return toAjax(yqqzjjsCwbService.updateYqqzjjsCwb(yqqzjjsCwb));
    }

    /**
     * 删除全宗卷介绍长文本
     */
    @PreAuthorize("@ss.hasPermi('archive:YqqzjjsCwb:remove')")
    @Log(title = "全宗卷介绍长文本", businessType = BusinessType.DELETE)
	@DeleteMapping("/{yqqzjjsIds}")
    public AjaxResult remove(@PathVariable String[] yqqzjjsIds)
    {
        return toAjax(yqqzjjsCwbService.deleteYqqzjjsCwbByYqqzjjsIds(yqqzjjsIds));
    }
}
